<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition   xmlns="http://www.w3.org/1999/xhtml"
			      xmlns:h="http://java.sun.com/jsf/html"
				  xmlns:p="http://primefaces.org/ui"
			      xmlns:f="http://java.sun.com/jsf/core"
			      xmlns:ui="http://java.sun.com/jsf/facelets"
			      > 
	
	
	 
	    <p:panel header="Search Options" toggleable="true" toggleOrientation="vertical" collapsed="false">  
   		<p:panelGrid columns="4" style="margin-bottom:10px;font-size:14px;" cellpadding="5">  
  		<f:facet name="header">  
        
    	</f:facet>  
  
  		<h:outputText value="Country: " />
		<p:selectOneMenu style="width:180px" id="OMCountries"
				value="#{outletMasterManagedBean.country}" required="true" requiredMessage="Required">
				<f:selectItem itemLabel="--Select Country--" itemValue="" />
				<f:selectItems value="#{servicesManagedBean.allCountriesList}" />
				<p:ajax update="OMDistributors" listener="#{outletMasterManagedBean.updateDistributorsList}"/>
		</p:selectOneMenu>
  
        <h:outputText value="Distributor: " />  
        <p:selectOneMenu style="width:120px" id="OMDistributors" value="#{outletMasterManagedBean.distributor}" required="true" requiredMessage="Required">    
         <f:selectItems value="#{outletMasterManagedBean.distList}" />
        </p:selectOneMenu>
         
         <h:outputText value="GUI: " />  
         <p:inputText value="#{outletMasterManagedBean.gui}"/>
         
         <p:column colspan="7">  
        <p:commandButton value="GO" update="OutletMasterPanel @form" action="#{outletMasterManagedBean.callOutletProcedure}" global="true" />
        </p:column> 
        
        <h:commandLink rendered="#{outletMasterManagedBean.methodCalled}">  
        <p:graphicImage value="NWDSAKMS-excel-logo.png" width="30" height="30" title="Export to Excel"  style="border:0;margin-left:5px"/>  
        <p:dataExporter type="xls" target="OutletMasterdataTable" fileName="Outlet_Master_#{servicesManagedBean.dateNow}" />  
    	</h:commandLink>    
    </p:panelGrid>
    
    </p:panel>    
    
<p:panel id="OutletMasterPanel"> 
<p:dataTable  rendered="#{outletMasterManagedBean.methodCalled}"
			  id="OutletMasterdataTable"
			  style="margin-top:5px" 
			  var="out" value="#{outletMasterManagedBean.omlist}"  
              paginator="true" 
              rows="30"   
              paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
              rowsPerPageTemplate="20,40,60,80" 
              lazy="true"    
              scrollRows="17" 
              >  
        <f:facet name="header">  
            Outlet Master Info  
        </f:facet> 
        <p:column >  
            <f:facet name="header">  
                    Distributor
            </f:facet>  
            <h:outputText value="#{out.distributorid} " />  
        </p:column>  
  
        <p:column >  
            <f:facet name="header" >  
                    GUI NO
            </f:facet>  
            <h:outputText value="#{out.guino} " />
        </p:column>  
  
  
        <p:column>
        <f:facet name="header">  
                    Created Date 
            </f:facet>  
           <h:outputText value="#{out.createddate} " />
        </p:column>  
        
        <p:column>
        <f:facet name="header">  
                   Outlet ID 
            </f:facet>  
           <h:outputText value="#{out.outletid} " />
        </p:column>
               
        <p:column>
        <f:facet name="header" >  
                    Outlet Name
            </f:facet>  
           <h:outputText value="#{out.outletname} " />
        </p:column> 
        
        <p:column>
        <f:facet name="header" >  
                    Banner
            </f:facet>  
            <h:outputText value="#{out.banner} " />
        </p:column>
        
        <p:column>
        <f:facet name="header" >  
                    Outlet Subtype
            </f:facet>  
            <h:outputText value="#{out.outletsubtype} " />
        </p:column>
        
        <p:column>
        <f:facet name="header" >  
                    Sales Region
            </f:facet>  
            <h:outputText value="#{out.localsalesregion} " />
        </p:column>
        
        <p:column>
        <f:facet name="header" >  
                    Sales Workforce
            </f:facet>  
            <h:outputText value="#{out.localsalesforce} " />
        </p:column>
        
                <p:column>
        <f:facet name="header" >  
                    Outlet Classification
            </f:facet>  
            <h:outputText value="#{out.outletclassification} " />
        </p:column>
       
    </p:dataTable> 
     </p:panel>
   
</ui:composition>